﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:mvvmLightCommand="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4"
             xmlns:behaviors="clr-namespace:Rio.Manager.Application.Behaviors"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             x:Class="Rio.Manager.Application.Views.GeneralParametersTabView"
             mc:Ignorable="d"
             d:DesignHeight="768"
             d:DesignWidth="1024">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Rio.Manager.Application;component/Skins/GeneralParametersTabSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <UserControl.DataContext>
        <Binding Path="GeneralParametersTab"
                 Source="{StaticResource Locator}" />
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <mvvmLightCommand:EventToCommand Command="{Binding InitializationCommand}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <StackPanel Orientation="Vertical"
                    d:LayoutOverrides="Height">

            <telerik:RadToolBar Height="30">
                <StackPanel Orientation="Horizontal"
                            d:LayoutOverrides="Height"
                            Margin="5,0,0,0">

                    <Image Margin="0,0,5,0"
                           Source="/Rio.Manager.Application;component/Assets/Images/search.png"
                           Width="16"
                           Height="16" />

                    <TextBox x:Name="filterBox"
                             TextWrapping="Wrap"
                             VerticalAlignment="Center"
                             HorizontalAlignment="Right"
                             Margin="0"
                             Width="300"
                             BorderBrush="Black">
                        <i:Interaction.Behaviors>
                            <behaviors:FilterGridViewByTextBehavior GridViewToFilter="{Binding ElementName=generalParametersGridView, Mode=OneWay}" />
                        </i:Interaction.Behaviors>
                    </TextBox>
                </StackPanel>
                <telerik:RadToolBarSeparator Margin="5,2" />
            </telerik:RadToolBar>

            <telerik:RadGridView x:Name="generalParametersGridView"
                                 ShowGroupPanel="False"
                                 AutoGenerateColumns="False"
                                 CanUserDeleteRows="False"
                                 CanUserInsertRows="False"
                                 IsFilteringAllowed="False"
                                 AlternationCount="2"
                                 AlternateRowBackground="#FFEBF7FF"
                                 ItemsSource="{Binding Parameters}">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Domain}"
                                                Header="Domaine"
                                                IsReadOnly="True" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                                                Header="Nom"
                                                IsReadOnly="True" />
                    <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsMandatory}"
                                                    Header="Obligatoire"
                                                    IsReadOnly="True" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"
                                                Header="Description"
                                                IsReadOnly="True" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Value}"
                                                Header="Valeur" />
                    <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsEnabled}"
                                                    Header="Actif" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

        </StackPanel>

    </Grid>
</UserControl>
